package com.aspose.cells;

import java.util.HashMap;

class zadj {
   public zado a = new zboo(this);
   public zado b = new zbpw(this);
   public zado c = new zaoi(this);
   public zado d = new zaim(this);
   public zado e = new zxq(this);
   public zado f = new zmp(this);
   public zado g;
   public String h;
   public Font i;
   public Worksheet j;
   public int k;
   public int l;
   public float m;
   public float n;
   public float o;
   public zadm p;
   private HashMap r;
   private PageSetup s;
   public double[] q;
   private static final com.aspose.cells.b.c.a.za t = new com.aspose.cells.b.c.a.za(new String[]{"Bold", "加粗", "Italic", "倾斜", "Regular", "常规"});

   public void a(String var1) {
      int var2 = var1.indexOf(44);
      if (var2 == -1) {
         this.i.setName(var1);
      } else {
         this.i.setName(var1.substring(0, 0 + var2));
         if (this.i.getName().startsWith("+")) {
            this.i.setName(this.j.getWorkbook().getDefaultStyle().q().getName());
         }

         var1 = var1.substring(var2 + 1);
         String[] var3 = com.aspose.cells.b.a.zv.d(var1, ' ');

         for(int var4 = 0; var4 < var3.length; ++var4) {
            switch(t.a(var3[var4])) {
            case 0:
            case 1:
               this.i.setBold(true);
               break;
            case 2:
            case 3:
               this.i.setItalic(true);
               break;
            case 4:
            case 5:
               this.i.setItalic(false);
               this.i.setBold(false);
            }
         }

      }
   }

   public int a(String[] var1) throws Exception {
      int var2 = 1;

      try {
         if (var1[0] != null) {
            var1[0] = com.aspose.cells.b.a.zv.a(var1[0], "\r\n", "\n");
         }

         while(var1[0].length() > 0 && var2 == 1) {
            var2 = this.g.a(var1);
         }
      } catch (Exception var4) {
         return var2;
      }

      if (this.h.length() > 0) {
         this.d();
      }

      return var2;
   }

   public void a() {
   }

   public void b() {
      this.p.a();
   }

   public void c() throws Exception {
      Picture var1 = this.e();
      this.p.a(this.a(var1.b() - 1), new com.aspose.cells.b.a.b.zt((float)(var1.getWidthPt() * this.q[0]), (float)(var1.getHeightPt() * this.q[1])));
   }

   public void d() throws Exception {
      zot var1 = new zot();
      var1.b = new Font(this.j.c(), (Object)null, false);
      var1.b.c(this.i);
      var1.b.setDoubleSize(Math.max(1.0D, var1.b.getDoubleSize() * this.q[1]));
      var1.a = this.h;
      if (!com.aspose.cells.a.d.zfs.a(var1.b.getName(), var1.b.m(), var1.a)) {
         Font var2 = this.j.getWorkbook().getDefaultStyle().q();
         if (com.aspose.cells.a.d.zfs.a(var2.getName(), var1.b.m(), var1.a)) {
            var1.b.setName(var2.getName());
         } else if (this.j.getWorkbook().getSaveOptions().e != null && this.j.getWorkbook().getSaveOptions().e.length() > 0) {
            var1.b.setName(this.j.getWorkbook().getSaveOptions().e);
         } else {
            var1.b.setName(com.aspose.cells.a.d.zbw.a);
         }
      }

      this.p.a(var1);
      this.h = "";
   }

   public zadj(zadm var1, Worksheet var2, HashMap var3, int var4, int var5, double var6, double var8) {
      this.j = var2;
      this.i = new Font(var2.c(), (Object)null, false);
      this.i.c(this.j.getWorkbook().getDefaultStyle().q());
      this.g = this.a;
      this.r = var3;
      this.p = var1;
      this.k = var4;
      this.l = var5;
      this.q = this.p.f;
      this.s = this.j.getPageSetup();
      this.h = "";
      this.m = (float)var6 * 72.0F;
      this.n = (float)var8 * 72.0F;
      switch(this.p.g) {
      case 1:
         this.o = this.m * 0.8F;
         break;
      case 7:
      case 8:
         this.o = this.m * 0.8F;
      }

      if (this.j.getType() == 2) {
         this.s = this.j.getCharts().get(0).getPageSetup();
      }

      this.a();
   }

   private com.aspose.cells.b.a.d.zh a(int var1) throws Exception {
      if (this.r.get(var1) != null) {
         com.aspose.cells.b.a.d.zh var6 = (com.aspose.cells.b.a.d.zh)this.r.get(var1);
         var6.a(0L, 0);
         return var6;
      } else if (var1 >= this.j.getWorkbook().getWorksheets().S().b().getCount()) {
         return new com.aspose.cells.b.a.d.zh();
      } else {
         zatx var2 = zaty.a(this.j.getWorkbook().getWorksheets().S().b().a(var1));
         zcb var3 = this.j.getWorkbook().getWorksheets().S().b().a(var1);
         com.aspose.cells.b.a.d.zh var4 = new com.aspose.cells.b.a.d.zh();
         if (var2.a() != null) {
            var4.b(var2.a(), 0, var2.a().length);
            var4.a(0L, 0);
            com.aspose.cells.b.a.b.zj var5 = com.aspose.cells.b.a.b.zj.a((com.aspose.cells.b.a.d.zm)var4);
            if (var5 instanceof com.aspose.cells.b.a.b.b.zf) {
               return var4;
            } else {
               var4 = new com.aspose.cells.b.a.d.zh();
               if (var5.i() >= 8 && var5.h() >= 8) {
                  switch(var5.c()) {
                  case 15:
                  case 65536:
                  case 131072:
                  case 197634:
                  case 198659:
                  case 1060876:
                     com.aspose.cells.a.d.zbn.b((com.aspose.cells.b.a.b.zj)var5, (com.aspose.cells.b.a.d.zm)var4);
                     break;
                  case 137224:
                  case 139273:
                     com.aspose.cells.a.d.zbn.a(var5, var4, 100L);
                     break;
                  default:
                     com.aspose.cells.a.d.zbn.b((com.aspose.cells.b.a.b.zj)var5, (com.aspose.cells.b.a.d.zm)var4);
                  }
               } else {
                  com.aspose.cells.a.d.zbn.a((com.aspose.cells.b.a.b.zj)var5, (com.aspose.cells.b.a.d.zm)var4);
               }

               var5.d();
               this.r.put(var1, var4);
               var4.a(0L, 0);
               return var4;
            }
         } else {
            return new com.aspose.cells.b.a.d.zh();
         }
      }
   }

   private Picture e() {
      Picture var1 = null;
      this.s = this.j.getPageSetup();
      ShapeCollection var2 = this.s.j();
      byte var3 = 0;
      switch(this.p.g) {
      case 1:
         var3 = 1;
         break;
      case 7:
         var3 = 0;
         break;
      case 8:
         var3 = 2;
      }

      boolean var4 = true;
      if (this.p.h == 0) {
         var4 = false;
      }

      boolean var5 = this.s.isHFDiffFirst() && this.k == 1;
      boolean var6 = this.s.isHFDiffOddEven() && this.k % 2 == 0;
      if (var2 != null) {
         var1 = this.s.getPicture(var5, var6, var4, var3);
      }

      return var1;
   }
}
